package com.consumerService.module.feignClient;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;

import com.consumerService.config.FeignConfiguration;
import com.consumerService.module.feignClient.fallback.ProviderServiceFallback;

import java.util.Map;

/**
 * FeignClient注解
 * name 指定调用的服务名称
 * path 指定藏在路径
 * fallbackFactory 指定熔断时调用的类
 */
@FeignClient(name = "provider-service",path="api",fallback = ProviderServiceFallback.class,configuration = FeignConfiguration.class)
public interface ProviderServiceClient {

    @GetMapping("/test/getMapInfo/{id}")
    Map<String,Object> getByFeignClient(@PathVariable("id") Integer id);

    @PostMapping("/test/postMapInfo")
    Map<String,Object> postByFeignClient(Map<String,Object> params);
}
